
public class Main {
    public static void main(String[] args) {
        Rational rational = new Rational();
        rational.setNumerator(15);
        rational.setDenominator(4);

        Rational rational1 = new Rational();
        rational1.setNumerator(2);
        rational1.setDenominator(4);
        //加法
        Rational result=rational1.add(rational);
        System.out.println("2/4+15/4的值为"+result.getNumerator()+"/"+result.getDenominator());
        //减法
        result=rational.sub(rational1);
        System.out.println("15/4-2/4的值为"+result.getNumerator()+"/"+result.getDenominator());
        //乘法
        result=rational1.muti(rational);
        System.out.println("2/4*15/4的值为"+result.getNumerator()+"/"+result.getDenominator());
        //除法
        result=rational1.div(rational);
        System.out.println("2/4÷15/4的值为"+result.getNumerator()+"/"+result.getDenominator());

    }
}
